package com.eastfair.venueservice.enumeration;

import com.eastfair.annotation.base.BaseEnum;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * <p>
 * 实体注释中生成的类型枚举
 * 违规处罚记录
 * </p>
 *
 * @author dqq
 * @date 2023-03-15
 */
@Getter
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "ViolationRecordCertificateViolationTypeEnum", description = "证件违规类型 #{PERSON:人证;CAR:车证;NOT_CERTIFICATE:非证件-枚举")
public enum ViolationRecordCertificateViolationTypeEnum implements BaseEnum {

    /**
     * PERSON="人证"
     */
    PERSON("人证"),
    /**
     * CAR="车证"
     */
    CAR("车证"),
    /**
     * NOT_CERTIFICATE="非证件"
     */
    NOT_CERTIFICATE("非证件"),
    ;

    @ApiModelProperty(value = "描述")
    private String desc;


    /**
     * 根据当前枚举的name匹配
     */
    public static ViolationRecordCertificateViolationTypeEnum match(String val, ViolationRecordCertificateViolationTypeEnum def) {
        return Stream.of(values()).parallel().filter(item -> item.name().equalsIgnoreCase(val)).findAny().orElse(def);
    }

    public static ViolationRecordCertificateViolationTypeEnum get(String val) {
        return match(val, null);
    }

    public boolean eq(ViolationRecordCertificateViolationTypeEnum val) {
        return val != null && eq(val.name());
    }

    @Override
    @ApiModelProperty(value = "编码", allowableValues = "PERSON,CAR,NOT_CERTIFICATE", example = "PERSON")
    public String getCode() {
        return this.name();
    }

}
